﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace BadHabit.Factory.Controls {
    /// <summary>
    /// Interaction logic for ProjectIndicator.xaml
    /// </summary>
    public partial class ProjectIndicator : UserControl {

        public ProjectIndicator() {
            InitializeComponent();
        }

        public bool IsIndicatorGood {
            set {
                if (!value) {
                    //nameBorder.Background = (Brush)Resources["NotGoodValueBackgroundBrush"];
                    indicatorNameTextBlock.Foreground = (Brush)Resources["NotGoodValueBrush"];
                    indicatorValueTextBlock.Foreground = (Brush)Resources["NotGoodValueBrush"];
                    indicatorUnitTextBlock.Foreground = (Brush)Resources["NotGoodValueBrush"];
                } else {
                    //nameBorder.Background = (Brush)Resources["GoodValueBackgroundBrush"];
                    indicatorNameTextBlock.Foreground = (Brush)Resources["GoodValueBrush"];
                    indicatorValueTextBlock.Foreground = (Brush)Resources["GoodValueBrush"];
                    indicatorUnitTextBlock.Foreground = (Brush)Resources["GoodValueBrush"];
                    
                }
            }
        }

        public string IndicatorName {            
            set {
                indicatorNameTextBlock.Text = value;
            }
        }

        public string IndicatorUnit {            
            set {
                indicatorUnitTextBlock.Text = value;
            }
        }

        public string IndicatorToolTip {
            set {
                toolTipTextBlock.Text = value;                
            }
        }

        private double indicatorValue = 0.0;

        public double IndicatorValue {
            get {
                return indicatorValue;
            }
            set {
                indicatorValue = value;
                indicatorValueTextBlock.Text = String.Format("{0:F1}", value);
                Image i = new Image();                
            }
        }

        public ImageSource IndicadorIcon {
            set {
                indicatorImage.Source = value;
            }
        }
    }
}
